[doc] use python 3.12 to perform policy check #58526
[doc] use python 3.12 to perform policy check #58526
Conversation
this makes it possible to run on a different python version than the CI wrapper code. Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
It is technically still using the resolved dependencies of python 3.9, but all libraries used are version agnostic, it should run. Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
|
this is built on top of #58516 |
There was a problem hiding this comment.
Code Review
This pull request updates the Python version for the policy check to 3.12 and refactors several scripts to remove dependencies on ray_ci.utils and ray_release. The changes replace a custom logger with standard print statements to sys.stderr, which is a reasonable simplification for CI scripts. The logic for determining when to perform a dry run in cmd_build.py has also been simplified. I've suggested a small refactoring to make the dry_run logic even cleaner. Overall, the changes are well-aligned with the goal of updating the Python environment and reducing dependencies.
| dry_run = False | ||
| if ( | ||
| os.environ.get("BUILDKITE_PIPELINE_ID") | ||
| not in get_global_config()["ci_pipeline_postmerge"] | ||
| ): | ||
| if os.environ.get("RAYCI_STAGE", "") != "postmerge": | ||
| dry_run = True | ||
| logger.info( | ||
| "Not uploading build artifacts because this is not a postmerge pipeline." | ||
| print( | ||
| "Not uploading build artifacts because this is not a postmerge pipeline.", | ||
| file=sys.stderr, | ||
| ) | ||
|
|
||
| if os.environ.get("BUILDKITE_BRANCH") != "master": | ||
| elif os.environ.get("BUILDKITE_BRANCH") != "master": | ||
| dry_run = True | ||
| logger.info( | ||
| "Not uploading build artifacts because this is not the master branch." | ||
| print( | ||
| "Not uploading build artifacts because this is not the master branch.", | ||
| file=sys.stderr, | ||
| ) |
There was a problem hiding this comment.
The logic to determine dry_run can be simplified. By setting dry_run to True by default and only changing it to False when the conditions for an upload are met, you can make the code more concise and avoid repeating dry_run = True.
| dry_run = False | |
| if ( | |
| os.environ.get("BUILDKITE_PIPELINE_ID") | |
| not in get_global_config()["ci_pipeline_postmerge"] | |
| ): | |
| if os.environ.get("RAYCI_STAGE", "") != "postmerge": | |
| dry_run = True | |
| logger.info( | |
| "Not uploading build artifacts because this is not a postmerge pipeline." | |
| print( | |
| "Not uploading build artifacts because this is not a postmerge pipeline.", | |
| file=sys.stderr, | |
| ) | |
| if os.environ.get("BUILDKITE_BRANCH") != "master": | |
| elif os.environ.get("BUILDKITE_BRANCH") != "master": | |
| dry_run = True | |
| logger.info( | |
| "Not uploading build artifacts because this is not the master branch." | |
| print( | |
| "Not uploading build artifacts because this is not the master branch.", | |
| file=sys.stderr, | |
| ) | |
| dry_run = True | |
| if os.environ.get("RAYCI_STAGE", "") != "postmerge": | |
| print( | |
| "Not uploading build artifacts because this is not a postmerge pipeline.", | |
| file=sys.stderr, | |
| ) | |
| elif os.environ.get("BUILDKITE_BRANCH") != "master": | |
| print( | |
| "Not uploading build artifacts because this is not the master branch.", | |
| file=sys.stderr, | |
| ) | |
| else: | |
| dry_run = False |
|
going to use python 3.10 instead. |
It is technically still using the resolved dependencies of python
3.9, but all libraries used are version agnostic, it should run.